import React, { Component } from 'react'
import { SelectItem } from "../types/vote"
interface Iprops {
    item: SelectItem,
    total: number,//总票数
    status: boolean //判断是否投过票
}
export class selecttem extends Component<Iprops, {}> {
    render() {
        let {text,num,id} = this.props.item;
        //status  判断该用户是否已经投过票
        let {status,total} = this.props;
        console.log(status);
        //状态：判断是否投过票
        //占比的宽度
        let width = num/total*100 + '%';
        return (
            <div className="select-warp">
                <div className="select-text" style={{display:status?'flex':''}}>
                    <span>{text}</span>
                    <span style={{display:status?'block':'none'}}>{num}</span>
                </div>
                <div className="process" style={{width,display:status?'block':'none'}}></div>
            </div>
        )
    }
}

export default selecttem
